package personresources.manager.dao;

import java.io.Serializable;

/**
 * Generic method
 * 
 * @author Duy Chuong
 * 
 * @param <T>
 *            Class
 * @param <PK>
 *            Primary Key of Entity
 */
public interface GenericDao<T, PK extends Serializable> {

	/**
	 * Get a object by primary key
	 * 
	 * @param key
	 *            primary key of object
	 * @return Object
	 */

	T read(PK key);
	/**
	 * Get a object by any properties
	 * @param properties nane of properties
	 * @param value of properties
	 * @return Object
	 */
	Object read(String property, Object value);

	/**
	 * Insert a object into DB
	 * 
	 * @param object
	 *            Object ti insert
	 */
	void create(T object);

	/**
	 * Remove a object in DB
	 * @param object Object to remove
	 */
	void delete(T object);
	
	/**
	 * Update a object
	 * @param object Object
	 */
	void update(T object);
}
